var express = require('express'),
    flash = require('connect-flash'),
    passport = require('passport');

module.exports = function(app, config) {
  app.configure(function () {
    app.set('port', process.env.PORT || 9090);
    app.set('views', config.root + '/app/view');
    app.set('view engine', 'jade');
    app.use(flash());
    app.use(express.favicon());
    app.use(express.logger('dev'));
    app.use(express.bodyParser({
        uploadDir: './uploads'
    }));
    app.use(express.methodOverride());
    app.use(express.cookieParser('your secret here'));
    app.use(express.session({secret: 'noobjs'}));
    app.use(express.static(config.root + '/public'));
    app.use(passport.initialize());
    app.use(passport.session());
    app.use(app.router);
  });
};
